package com.thinvent.remotepassword.entity;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.sql.Timestamp;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class WikiRebot extends Model<WikiRebot> {

    private String id; // 主键，自动增长

    private String rebotName; // 机器人名称，非空，最大长度255字符

    private Boolean isDeploy; // 是否部署，默认为false（0）

    private Boolean isConfig; // 是否配置，默认为false（0）

    private String docIds; // 文档ID列表，逗号分隔的字符串

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp createTime; // 创建时间，默认为当前时间

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp updateTime; // 更新时间，默认为创建时的时间，并在每次更新时自动更新到当前时间
    
    private String promptWord; // 提示词字段

    private String manualReplyContent;// 人工回复字段

    private String welcomeMessage;// 机器人欢迎语

    // 便捷方法：将逗号分隔的字符串转换为Integer列表
    public List<String> getDocIdList() {
        if (docIds == null || docIds.isEmpty()) {
            return Collections.emptyList();
        }
        return Stream.of(docIds.split(","))
                .collect(Collectors.toList());
    }

    // 便捷方法：将String列表转换为逗号分隔的字符串
    public void setDocIdList(List<String> docIdList) {
        if (docIdList != null && !docIdList.isEmpty()) {
            this.docIds = docIdList.stream()
                    .map(String::valueOf)
                    .collect(Collectors.joining(","));
        } else {
            this.docIds = "";
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getRebotName() {
        return rebotName;
    }

    public void setRebotName(String rebotName) {
        this.rebotName = rebotName;
    }

    public Boolean getDeploy() {
        return isDeploy;
    }

    public void setDeploy(Boolean deploy) {
        isDeploy = deploy;
    }

    public Boolean getConfig() {
        return isConfig;
    }

    public void setConfig(Boolean config) {
        isConfig = config;
    }

    public String getDocIds() {
        return docIds;
    }

    public void setDocIds(String docIds) {
        this.docIds = docIds;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    public String getPromptWord() {
        return promptWord;
    }

    public void setPromptWord(String promptWord) {
        this.promptWord = promptWord;
    }

    public String getManualReplyContent() {
        return manualReplyContent;
    }

    public void setManualReplyContent(String manualReplyContent) {
        this.manualReplyContent = manualReplyContent;
    }

    public String getWelcomeMessage() {
        return welcomeMessage;
    }

    public void setWelcomeMessage(String welcomeMessage) {
        this.welcomeMessage = welcomeMessage;
    }
}
